package com.ntd.pay.channel.douyin;

import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.ntd.pay.NtdPay;
import com.ntd.pay.channel.douyin.config.DouYinPayConfig;
import com.ntd.pay.channel.douyin.model.out.DouYinCreateOrderOutBO;
import com.ntd.pay.channel.model.out.NtdPayCreateOrderOutBO;

import java.util.HashMap;
import java.util.Map;

/**
 * 抖音支付实现
 *
 * @author liuwenju
 * @date 2021/09/23
 */
public class DouYinPayImpl implements NtdPay {

    /**
     * 统一下单
     *
     * @return {@link String}
     */
    @Override
    public NtdPayCreateOrderOutBO createOrder() {
        Map<String, Object> params = new HashMap<>();
        String res = HttpUtil.post(DouYinPayConfig.CREATE_ORDER_URL, params);
        DouYinCreateOrderOutBO douYinCreateOrderOutBO = JSONUtil.toBean(res, DouYinCreateOrderOutBO.class);
        return DouYinCreateOrderOutBO.transform(douYinCreateOrderOutBO);
    }

    @Override
    public void callbackNotify(String data) {


    }
}
